package Crawler;


//import com.sun.deploy.util.StringUtils;

import java.util.StringTokenizer;

/**
 * StringTokenizer切分字符串
 */

public class StringTest {

    public static void main(String[] args) {
        String uid_connum = "1894580102,556";

        System.out.println("StringTokenizer:");

        long st3 = System.nanoTime();
        StringTokenizer token = new StringTokenizer(uid_connum, ",");
        while (token.hasMoreElements()) {
            // nextToken()打印下一个字段
            System.out.print(token.nextToken() + "\n");
        }
        System.out.println("TIME:" + (System.nanoTime() - st3));


        String ip = "192.168.20.121";

        long st1 = System.nanoTime();
        String[] ips = ip.split("\\.");
        System.out.println("jdk的split切分:");
        for (int i = 0; i < ips.length; i++) {
            System.out.print(ips[i] + "  ");
        }
        System.out.println("花费时间" + (System.nanoTime() - st1));


    }

}
